package org.yang.order.food.controller;

import org.yang.order.food.common.Msg;
import org.yang.order.food.entity.Merchant;
import org.yang.order.food.service.MerchantService;
import org.springframework.web.bind.annotation.*;

import com.github.pagehelper.PageInfo;

import javax.annotation.Resource;
/**
 * 商户控制器
 * @author shichenyang
 * @email gyv12345@163.com
 * @date 2018/12/03
 */
@RestController
@RequestMapping("/merchant")
public class MerchantController {
    @Resource
    private MerchantService merchantService;

    @GetMapping("/getMerchants")
    public PageInfo getMerchants(Merchant merchant,Integer page,Integer limit){
        return merchantService.getMerchants(merchant,page,limit);
    }
    @PostMapping("/addMerchant")
    public Msg addMerchant(Merchant merchant){
        return merchantService.addMerchant(merchant);
    }

    @PutMapping("/updateMerchant")
    public Msg updateMerchant(Merchant merchant){
        return merchantService.updateMerchant(merchant);
    }

    @DeleteMapping("/delMerchant")
    public Msg delMerchant(Merchant merchant){
        return merchantService.delMerchant(merchant);
    }
}
